﻿using System.ComponentModel.DataAnnotations;
using Dexter.Core.Helpers;
using Dexter.Web.Mvc.ViewModel.Resources;

namespace Dexter.Web.Mvc.ViewModel.Backoffice.Binders {
	public class CategoryBinder {

		[Required ( ErrorMessageResourceType = typeof ( Errors ), ErrorMessageResourceName = "RequiredField" )]
		public string Name { get; set; }

		[StringLength ( 1000, ErrorMessageResourceType = typeof ( Errors ), ErrorMessageResourceName = "MaximumLengthExceeded" )]
		[RegularExpression ( KnownRegex.Url, ErrorMessageResourceType = typeof ( Errors ), ErrorMessageResourceName = "InvalidFormat" )]
		public string FeedBurnerUrl { get; set; }

		[StringLength ( 250, ErrorMessageResourceType = typeof ( Errors ), ErrorMessageResourceName = "MaximumLengthExceeded" )]
		public string Description { get; set; }

		public int? ParentId { get; set; }

		public static CategoryBinder EmptyInstance ( ) {
			return new CategoryBinder ( );
		}
	}
}